home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / dfltsc11.lha / DefaultScreen.s < prev   
Text File  |  1995-05-03  |  3KB  |  136 lines

  1. ;
  2. ; DefaultScreen is Copyright © 1994-1995 by Stefano Reksten of 3AM.
  3. ; It was made just to learn how to use the ReadArgs() function and the
  4. ; LINK/UNLK instructions (these make the program 100 bytes smaller! :-)
  5. ;
  6. ; This program changes the default public screen and can set the
  7. ; SHANGHAI and POPPUBSCREEN flags, if passed the correct arguments.
  8. ; I know there are other utilities like (my) PSM to manage public screens,
  9. ; but not as small as this one!
  10. ;
  11. ; Many thanks to Benjamin Hutchings, who debugged this program.
  12. ; I hope to have corrected the bugs :-)
  13. ;
  14. ; To contact me:
  15. ;
  16. ; rekststef@unisi.it
  17. ;
  18. ; Stefano Reksten c/o Naimi
  19. ; v.le Cavour, 40
  20. ; 53100 SIENA - Italy
  21. ;
  22.     incdir    "include:"
  23.     include "LVO3.0/exec_lib.i"
  24.     include "LVO3.0/dos_lib.i"
  25.     include "LVO3.0/intuition_lib.i"
  26.  
  27. SHANGHAI    equ    $0001
  28. POPPUBSCREEN    equ    $0002
  29.  
  30. DOSBase        equ    0
  31. IntuiBase    equ    4
  32. ArgsPtr        equ    8
  33. Args        equ    12
  34. ScrName        equ    12
  35. SFLG        equ    16
  36. PFLG        equ    20
  37. ScrPtr        equ    24
  38.  
  39.     link    a5,#-28
  40.     move.l    4,a6
  41.     lea    IntuiName(PC),a1
  42.     move.l    #37,d0
  43.     jsr    _LVOOpenLibrary(a6)
  44.     tst.l    d0
  45.     beq.w    .intuiexit
  46.     move.l    d0,IntuiBase(SP)
  47.  
  48.     lea    DOSName(PC),a1
  49.     move.l    #37,d0
  50.     jsr    _LVOOpenLibrary(a6)
  51.     tst.l    d0
  52.     beq.w    .dosexit
  53.     move.l    d0,DOSBase(SP)
  54.  
  55.     move.l    #0,ScrName(SP)
  56.     move.l    #0,SFLG(SP)
  57.     move.l    #0,PFLG(SP)
  58.     move.l    d0,a6
  59.     move.l    #Template,d1
  60.     move.l    SP,d2
  61.     add.l    #Args,d2
  62.     moveq    #0,d3
  63.     jsr    _LVOReadArgs(a6)
  64.     tst.l    d0
  65.     beq.b    .noscrname
  66.  
  67.     move.l    d0,ArgsPtr(SP)
  68.  
  69.     move.l    ScrName(SP),d0
  70.     move.l    IntuiBase(SP),a6
  71.     move.l    d0,a0
  72.     jsr    _LVOLockPubScreen(a6)
  73.  
  74.     tst.l    d0
  75.     beq.b    .nopublic
  76.     move.l    d0,ScrPtr(SP)
  77.  
  78.     move.l    ScrName(SP),a0
  79.     jsr    _LVOSetDefaultPubScreen(a6)
  80.  
  81.     moveq    #0,d0
  82.     tst.l    SFLG(SP)
  83.     beq.b    .noshanghai
  84.     or    #SHANGHAI,d0
  85. .noshanghai
  86.     tst.l    PFLG(SP)
  87.     beq.b    .nopopup
  88.     or    #POPPUBSCREEN,d0
  89. .nopopup
  90.     jsr    _LVOSetPubScreenModes(a6)
  91.  
  92.     move.l    #0,a0
  93.     move.l    ScrPtr(a2),a1
  94.     jsr    _LVOUnlockPubScreen(a6)
  95.     
  96.     bra.b    .freeargs
  97.  
  98. .nopublic
  99.     move.l    DOSBase(SP),a6
  100.     move.l    #ErrNoPublic,d1
  101.     move.l    SP,d2
  102.     add.l    #Args,d2
  103.     jsr    _LVOVPrintf(a6)
  104.     bra.b    .freeargs
  105.     
  106. .noscrname
  107.     move.l    #ErrNoName,d1
  108.     jsr    _LVOVPrintf(a6)
  109.     bra    .closeDOS
  110. .freeargs
  111.     move.l    DOSBase(SP),a6
  112.     move.l    ArgsPtr(SP),d1
  113.     jsr    _LVOFreeArgs(a6)
  114. .closeDOS
  115.     move.l    4,a6
  116.     move.l    DOSBase(SP),a1
  117.     jsr    _LVOCloseLibrary(a6)
  118. .dosexit
  119.     move.l    IntuiBase(SP),a1
  120.     jsr    _LVOCloseLibrary(a6)
  121. .intuiexit
  122.     unlk    a5
  123.     rts
  124.  
  125. DOSName
  126.     dc.b    'dos.library',0
  127. IntuiName
  128.     dc.b    'intuition.library',0
  129. Template
  130.     dc.b    'ScreenName/A,S=Shanghai/S,P=PopScreen/S',0
  131.     dc.b    '$VER: DefaultScreen v1.1 (3.5.95)',0
  132. ErrNoName
  133.     dc.b    'No public screen name given',$A,0
  134. ErrNoPublic
  135.     dc.b    '%s is not a public screen',$A,0
  136.